#include<iostream>
#include<fstream>
#include<cstdlib>

using namespace std;

int main()
{
	char name[50]{};
	int age, scores;
	
	cout << "name:";
	cin.getline(name, 50);
	cout << "age:";
	cin >> age;
	cout << "scores:";
	cin >> scores;
	
	ofstream fout;
	fout.open("info.txt");
	if (!fout.is_open())
		exit(1);
	
	fout << "name:" << name << endl;;
	fout << "age:" << age << endl;
	fout << "scores:" << scores << endl;
	
	fout.close();
	
	ifstream fin;
	fin.open("info.txt");
	if (!fin.is_open())
		exit(1);
	char iname[50]{};
	
	fin.getline(iname, 50);
	cout << iname << endl;
	fin.getline(iname, 50);
	cout << iname << endl;
	fin.getline(iname, 50);
	cout << iname << endl;
	fin.close();
	return 0;
}
